$OpenBSD: patch-CMakeLists_txt,v 1.2 2011/11/09 23:24:56 dcoppa Exp $
--- CMakeLists.txt.orig	Thu Sep  2 15:27:37 2010
+++ CMakeLists.txt	Sun Oct 24 08:11:32 2010
@@ -32,7 +32,9 @@ OPTION(WANT_CAPS	"Include C* Audio Plugin Suite (LADSP
 OPTION(WANT_CMT		"Include Computer Music Toolkit LADSPA plugins" ON)
 OPTION(WANT_FFTW3F	"Include SpectrumAnalyzer and ZynAddSubFX plugin" ON)
 OPTION(WANT_JACK	"Include JACK (Jack Audio Connection Kit) support" ON)
+OPTION(WANT_SNDIO	"Include sndio support" ON)
 OPTION(WANT_OGGVORBIS	"Include OGG/Vorbis support" ON)
+OPTION(WANT_OSS		"Include OSS (Open Sound System) support" ON)
 OPTION(WANT_PULSEAUDIO	"Include PulseAudio support" ON)
 #OPTION(WANT_PORTAUDIO	"Include PortAudio support" ON)	# TODO: fix PortAudio support
 OPTION(WANT_SDL		"Include SDL (Simple DirectMedia Layer) support" ON)
@@ -48,12 +50,16 @@ OPTION(WANT_WINMM	"Include WinMM MIDI support" OFF)
 IF(LMMS_BUILD_WIN32)
 	SET(WANT_ALSA OFF)
 	SET(WANT_JACK OFF)
+	SET(WANT_OSS OFF)
+	SET(WANT_SNDIO OFF)
 	SET(WANT_PULSEAUDIO OFF)
 	SET(WANT_SYSTEM_SR OFF)
 	SET(WANT_WINMM ON)
 	SET(LMMS_HAVE_WINMM TRUE)
 	SET(STATUS_ALSA "<not supported on this platform>")
 	SET(STATUS_JACK "<not supported on this platform>")
+	SET(STATUS_OSS "<not supported on this platform>")
+	SET(STATUS_SNDIO "<not supported on this platform>")
 	SET(STATUS_PULSEAUDIO "<not supported on this platform>")
 	SET(STATUS_WINMM "OK")
 ELSE(LMMS_BUILD_WIN32)
@@ -68,16 +74,19 @@ CHECK_INCLUDE_FILES(pthread.h LMMS_HAVE_PTHREAD_H)
 CHECK_INCLUDE_FILES(semaphore.h LMMS_HAVE_SEMAPHORE_H)
 CHECK_INCLUDE_FILES(unistd.h LMMS_HAVE_UNISTD_H)
 CHECK_INCLUDE_FILES(sys/types.h LMMS_HAVE_SYS_TYPES_H)
-CHECK_INCLUDE_FILES(sys/ipc.h LMMS_HAVE_SYS_IPC_H)
-CHECK_INCLUDE_FILES(sys/shm.h LMMS_HAVE_SYS_SHM_H)
+IF(LMMS_HAVE_SYS_TYPES_H)
+  CHECK_INCLUDE_FILES("sys/types.h;sys/ipc.h" LMMS_HAVE_SYS_IPC_H)
+  CHECK_INCLUDE_FILES("sys/types.h;sys/shm.h" LMMS_HAVE_SYS_SHM_H)
+ELSE(LMMS_HAVE_SYS_TYPES_H)
+  CHECK_INCLUDE_FILES(sys/ipc.h LMMS_HAVE_SYS_IPC_H)
+  CHECK_INCLUDE_FILES(sys/shm.h LMMS_HAVE_SYS_SHM_H)
+ENDIF(LMMS_HAVE_SYS_TYPES_H)
 CHECK_INCLUDE_FILES(sys/time.h LMMS_HAVE_SYS_TIME_H)
 CHECK_INCLUDE_FILES(sys/wait.h LMMS_HAVE_SYS_WAIT_H)
 CHECK_INCLUDE_FILES(sys/select.h LMMS_HAVE_SYS_SELECT_H)
 CHECK_INCLUDE_FILES(stdarg.h LMMS_HAVE_STDARG_H)
 CHECK_INCLUDE_FILES(signal.h LMMS_HAVE_SIGNAL_H)
 CHECK_INCLUDE_FILES(sched.h LMMS_HAVE_SCHED_H)
-CHECK_INCLUDE_FILES(sys/soundcard.h LMMS_HAVE_SYS_SOUNDCARD_H)
-CHECK_INCLUDE_FILES(soundcard.h LMMS_HAVE_SOUNDCARD_H)
 CHECK_INCLUDE_FILES(fcntl.h LMMS_HAVE_FCNTL_H)
 CHECK_INCLUDE_FILES(sys/ioctl.h LMMS_HAVE_SYS_IOCTL_H)
 CHECK_INCLUDE_FILES(ctype.h LMMS_HAVE_CTYPE_H)
@@ -232,12 +241,18 @@ ENDIF(WANT_OGGVORBIS)
 
 
 # check whether to enable OSS-support
-IF(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
-	SET(LMMS_HAVE_OSS TRUE)
-	SET(STATUS_OSS "OK")
-ELSE(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
-	SET(STATUS_OSS "<not found or not supported on this platform>")
-ENDIF(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
+IF(WANT_OSS)
+	CHECK_INCLUDE_FILES(sys/soundcard.h LMMS_HAVE_SYS_SOUNDCARD_H)
+	CHECK_INCLUDE_FILES(soundcard.h LMMS_HAVE_SOUNDCARD_H)
+	IF(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
+		SET(LMMS_HAVE_OSS TRUE)
+		SET(STATUS_OSS "OK")
+	ELSE(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
+		SET(STATUS_OSS "<not found or not supported on this platform>")
+	ENDIF(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
+ELSE(WANT_OSS)
+	SET(STATUS_OSS "disabled")
+ENDIF(WANT_OSS)
 
 
 # check for ALSA
@@ -269,6 +284,18 @@ IF(WANT_JACK)
 ENDIF(WANT_JACK)
 
 
+# check for SNDIO
+IF(WANT_SNDIO)
+	FIND_PACKAGE(Sndio)
+	IF(SNDIO_FOUND)
+		SET(LMMS_HAVE_SNDIO TRUE)
+		SET(STATUS_SNDIO "OK")
+	ELSE(SNDIO_FOUND)
+		SET(STATUS_SNDIO "not found")
+	ENDIF(SNDIO_FOUND)
+ENDIF(WANT_SNDIO)
+
+
 # check for FFTW3F-library
 IF(WANT_FFTW3F)
 	PKG_CHECK_MODULES(FFTW3F fftw3f>=3.0.0)
@@ -364,8 +391,8 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/plugins/zynaddsubfx
 
 # set compiler flags
 #SET(CMAKE_BUILD_TYPE relwithdebug)
-SET(CMAKE_C_FLAGS "-O2 -g -Wall ${CMAKE_C_FLAGS}")
-SET(CMAKE_CXX_FLAGS "-O2 -g -fno-exceptions -Wall ${CMAKE_CXX_FLAGS}")
+SET(CMAKE_C_FLAGS "-g -Wall ${CMAKE_C_FLAGS}")
+SET(CMAKE_CXX_FLAGS "-g -fno-exceptions -Wall ${CMAKE_CXX_FLAGS}")
 #SET(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_C_FLAGS}")
 #SET(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_CXX_FLAGS}")
 
@@ -381,7 +408,8 @@ SET(lmms_MOC ${lmms_INCLUDES})
 
 SET(lmms_EMBEDDED_RESOURCES ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/COPYING)
 
-QT4_WRAP_CPP(lmms_MOC_out ${lmms_MOC} OPTIONS -nw)
+#QT4_WRAP_CPP(lmms_MOC_out ${lmms_MOC} OPTIONS -nw)
+QT4_WRAP_CPP(lmms_MOC_out ${lmms_MOC})
 QT4_WRAP_UI(lmms_UI_out ${lmms_UI})
 
 
@@ -428,9 +456,9 @@ ADD_SUBDIRECTORY(data)
 #
 ADD_DEFINITIONS(-D'LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/"' -D'PLUGIN_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/lmms/"' ${PULSEAUDIO_DEFINITIONS} ${PORTAUDIO_DEFINITIONS})
 
-INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${SDL_INCLUDE_DIR} ${PORTAUDIO_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIR} ${JACK_INCLUDE_DIRS} ${OGGVORBIS_INCLUDE_DIR} ${SAMPLERATE_INCLUDE_DIRS} ${SNDFILE_INCLUDE_DIRS})
-LINK_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/lib ${ASOUND_LIBRARY_DIR} ${JACK_LIBRARY_DIRS} ${SAMPLERATE_LIBRARY_DIRS} ${SNDFILE_LIBRARY_DIRS})
-LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} ${ASOUND_LIBRARY} ${SDL_LIBRARY} ${PORTAUDIO_LIBRARIES} ${PULSEAUDIO_LIBRARIES} ${JACK_LIBRARIES} ${OGGVORBIS_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${SNDFILE_LIBRARIES})
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${SDL_INCLUDE_DIR} ${PORTAUDIO_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIR} ${SNDIO_INCLUDE_DIRS} ${JACK_INCLUDE_DIRS} ${OGGVORBIS_INCLUDE_DIR} ${SAMPLERATE_INCLUDE_DIRS} ${SNDFILE_INCLUDE_DIRS})
+LINK_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/lib ${ASOUND_LIBRARY_DIR} ${SNDIO_LIBRARY_DIRS} ${JACK_LIBRARY_DIRS} ${SAMPLERATE_LIBRARY_DIRS} ${SNDFILE_LIBRARY_DIRS})
+LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} ${ASOUND_LIBRARY} ${SDL_LIBRARY} ${PORTAUDIO_LIBRARIES} ${PULSEAUDIO_LIBRARIES} ${SNDIO_LIBRARY} ${JACK_LIBRARIES} ${OGGVORBIS_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${SNDFILE_LIBRARIES})
 
 ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/lmms.1.gz COMMAND gzip -c ${CMAKE_SOURCE_DIR}/lmms.1 > ${CMAKE_BINARY_DIR}/lmms.1.gz DEPENDS ${CMAKE_SOURCE_DIR}/lmms.1 COMMENT "Generating lmms.1.gz")
 
@@ -466,7 +494,7 @@ ELSE(LMMS_BUILD_WIN32)
 	ENDIF(NOT LMMS_BUILD_APPLE)
 
 	INSTALL(TARGETS lmms RUNTIME DESTINATION bin)
-	INSTALL(FILES ${CMAKE_BINARY_DIR}/lmms.1.gz DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1/ PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
+	INSTALL(FILES ${CMAKE_SOURCE_DIR}/lmms.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1/ PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
 
 ENDIF(LMMS_BUILD_WIN32)
 
@@ -590,6 +618,7 @@ MESSAGE(
 "--------------------------\n"
 "* ALSA                        : ${STATUS_ALSA}\n"
 "* JACK                        : ${STATUS_JACK}\n"
+"* SNDIO                       : ${STATUS_SNDIO}\n"
 "* OSS                         : ${STATUS_OSS}\n"
 #"* PortAudio                   : ${STATUS_PORTAUDIO}\n"
 "* PulseAudio                  : ${STATUS_PULSEAUDIO}\n"
@@ -601,6 +630,7 @@ MESSAGE(
 "-------------------------\n"
 "* ALSA                        : ${STATUS_ALSA}\n"
 "* OSS                         : ${STATUS_OSS}\n"
+"* SNDIO                       : ${STATUS_SNDIO}\n"
 "* WinMM                       : ${STATUS_WINMM}\n"
 )
 
